package com.zhou.essearch.document;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.io.Serializable;
import java.util.Date;

@Data
@Document(indexName = "log")
@Setting(shards = 1, replicas = 2)
public class EsLog implements Serializable{

    private static final long serialVersionUID = 1L;

    @Id
    private String id;

    private String createBy;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @Field(type = FieldType.Date, index = false, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime = new Date();

    private Long timeMillis = System.currentTimeMillis();

    private String updateBy;

    private Integer delFlag;

    @Field(type = FieldType.Text)
    private String name;

    private Integer logType;

    private String requestUrl;

    private String requestType;

    private String requestParam;

    private String username;

    private String ip;

    private String ipInfo;

    private Integer costTime;

}